package com.project.mapper;

import com.project.bean.ProductBean;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface IProductMapper {
    @Insert("insert into t_product(p_name,p_createDate,p_price)" +
            " values(#{name},#{createDate},#{price})")
    public void add(ProductBean product);

    @Delete("delete from t_product where pk_productId=#{id}")
    public void del(int id);

    @Update("update t_product set p_price=#{price} where pk_productId=#{id}")
    public void update(@Param("id") int id,@Param("price") int price);

    @Select("select * from t_product")
    @ResultMap("productMap")
    public List<ProductBean> findAll();
    @Select("select * from t_product where pk_productId=#{id}")
    @ResultMap("productMap")
    public ProductBean findById(int id);
}
